I know that several similar questions exist on this topic, but to my knowledge all of them concern an async code (wrongly) written by the user, while in my case it comes from a Python package.
I have a Jupyter notebook whose first cell is
! pip install numpy
! pip install pandas
and I want to automatically play the notebook using Papermill. No problem on my local machine (Windows 11 with Python 3.7): I install iPyKernel and Papermill and everything is fine.
The problem is when I try to do the same on my BitBucket pipeline (Python image 3-alpine, but it happens under different others); the first cell throws the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 461, in dispatch_queue
await self.process_one()
File "/usr/local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 450, in process_one
await dispatch(*args)
TypeError: object NoneType can't be used in 'await' expression
that makes the script stop at the 2nd cell, where I import numpy.
If it can be relevant, I've "papermilled" under the GitLab CI without any problem in the past.
Seems to be a bug in ipykernel 6.9.0 - options that worked for me:
6.9.1 (latest version as of 2022-02-22); e.g. via pip install ipykernel --upgrade6.8.0 (if upgrading messes with other dependencies you might have); e.g. via pip install ipykernel==6.8.0